package com.stone.framework.user.entity;

import javax.persistence.Column;
import javax.persistence.Entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.stone.framework.core.entity.CommonEntity;
import com.stone.framework.core.util.Strings;

@TableName("ST_ROLE")
@Entity(name = "ST_ROLE")
public class Role extends CommonEntity {

    private static final long serialVersionUID = 1893527398539994088L;

    @TableField("CODE")
    @Column(name = "CODE")
    private String code;

    @TableField("NAME")
    @Column(name = "NAME")
    private String name;

    @TableField("DESC_")
    @Column(name = "DESC_")
    private String desc;

    @TableField("STATE")
    @Column(name = "STATE")
    private State state;

    public static enum State {
        DISABLED, ENABLED;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getState() {
        return state == null ? null : state.name();
    }

    public void setState(String state) {
        this.state = Strings.isEmpty(state) ? null : State.valueOf(state);
    }

    @Override
    public String toString() {
        return "Role [code=" + code + ", name=" + name + ", desc=" + desc + ", state=" + state + ", " + super.toString()
            + "]";
    }

}
